package com.ccc.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Storage entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "storage")
public class Storage implements java.io.Serializable {

	// Fields

	private Integer storageId;
	private String storageType;
	private Integer storageRentPrice;
	private Integer storageBuyPrice;
	private Integer storageVol;
	private Set<UserStorage> userStorages = new HashSet<UserStorage>(0);

	// Constructors

	/** default constructor */
	public Storage() {
	}

	/** minimal constructor */
	public Storage(String storageType, Integer storageRentPrice,
			Integer storageBuyPrice, Integer storageVol) {
		this.storageType = storageType;
		this.storageRentPrice = storageRentPrice;
		this.storageBuyPrice = storageBuyPrice;
		this.storageVol = storageVol;
	}

	/** full constructor */
	public Storage(String storageType, Integer storageRentPrice,
			Integer storageBuyPrice, Integer storageVol,
			Set<UserStorage> userStorages) {
		this.storageType = storageType;
		this.storageRentPrice = storageRentPrice;
		this.storageBuyPrice = storageBuyPrice;
		this.storageVol = storageVol;
		this.userStorages = userStorages;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "storageId", unique = true, nullable = false)
	public Integer getStorageId() {
		return this.storageId;
	}

	public void setStorageId(Integer storageId) {
		this.storageId = storageId;
	}

	@Column(name = "storageType", nullable = false, length = 50)
	public String getStorageType() {
		return this.storageType;
	}

	public void setStorageType(String storageType) {
		this.storageType = storageType;
	}

	@Column(name = "storageRentPrice", nullable = false)
	public Integer getStorageRentPrice() {
		return this.storageRentPrice;
	}

	public void setStorageRentPrice(Integer storageRentPrice) {
		this.storageRentPrice = storageRentPrice;
	}

	@Column(name = "storageBuyPrice", nullable = false)
	public Integer getStorageBuyPrice() {
		return this.storageBuyPrice;
	}

	public void setStorageBuyPrice(Integer storageBuyPrice) {
		this.storageBuyPrice = storageBuyPrice;
	}

	@Column(name = "storageVol", nullable = false)
	public Integer getStorageVol() {
		return this.storageVol;
	}

	public void setStorageVol(Integer storageVol) {
		this.storageVol = storageVol;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "storage")
	public Set<UserStorage> getUserStorages() {
		return this.userStorages;
	}

	public void setUserStorages(Set<UserStorage> userStorages) {
		this.userStorages = userStorages;
	}

}